package com.jmyd.sharding.server.domain.po;

import com.jmyd.sharding.server.domain.dto.AddressDto;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @author samphin
 * @date 2021/8/5 10:05
 */
@Data
@Table(name = "t_address")
public class TAddress {

    @Id
    private Long id;

    /**
     * 编码
     */
    private String code;

    /**
     * 名称
     */
    private String name;

    /**
     * 父id
     */
    private String pid;

    /**
     * 1国家2省3市4县区
     */
    private Integer type;

    /**
     * 数据分片计算值
     */
    private Integer lit;

    public TAddress build(AddressDto dto) {
        BeanUtils.copyProperties(dto, this);
        return this;
    }
}